export interface AnalyzeData {
  domains: { key: string; value: number }[]
  ips: { key: string; value: number }[]
  staticFiles: { key: string; value: number }[]
  pages: { key: string; value: number }[]
  referers: { key: string; value: number }[]
  spiders: { key: string; value: number }[]
  userAgents: { key: string; value: number }[]
  fileFlows: { key: string; value: number }[]
  dataFolders: { key: string; value: number }[]
}

export async function fetchAnalyze(file: string = "iis.log", targetHost: string = ""): Promise<AnalyzeData> {
    const params = new URLSearchParams({ file, targetHost })
    const res = await fetch(`http://localhost:5000/analyze?${params.toString()}`)
    if (!res.ok) throw new Error('API请求失败')
    return await res.json()
}